﻿#include "FITKTimeHistoryACCEL.h"
#include "FITK_Kernel/FITKCore/FITKEnumTransformer.hpp"
#include <QSet>

namespace Radioss
{
    FITKTimeHistoryACCEL::~FITKTimeHistoryACCEL()
    {
    }

    FITKTimeHistoryACCEL::TimeHistoryType FITKTimeHistoryACCEL::getTimeHistoryType()
    {
        return TimeHistoryType::TimeHistory_ACCEL;
    }

    void FITKTimeHistoryACCEL::setVarlableGroupType(THACCELVariableGroup type)
    {
        m_varlableGroupType = type;
    }

    FITKTimeHistoryACCEL::THACCELVariableGroup FITKTimeHistoryACCEL::getVarlableGroupType()
    {
        return THACCELVariableGroup(m_varlableGroupType);
    }


    void FITKTimeHistoryACCEL::setCustomizeVariable(QList<TimeHistoryACCELVariable> variables)
    {
        for (TimeHistoryACCELVariable var : variables)
            m_customizeVarlable.append(var);
    }

    QList<FITKTimeHistoryACCEL::TimeHistoryACCELVariable> FITKTimeHistoryACCEL::getCustomizeVariable()
    {
        QList<TimeHistoryACCELVariable> typeList;
        for (int var : m_customizeVarlable)
            typeList.append(TimeHistoryACCELVariable(var));
        return typeList;
    }

    QStringList FITKTimeHistoryACCEL::getVariableKeyWords()
    {
        QSet<QString> set{};
        for (int var : m_customizeVarlable) {
            Core::FITKEnumTransfer<TimeHistoryACCELVariable> et;
            bool ok = false;
            QString str = et.toString((TimeHistoryACCELVariable)var, ok);
            if (ok) set += str;
        }
        QStringList keyWords = set.toList();

        THACCELVariableGroup groupType = (THACCELVariableGroup)m_varlableGroupType;
        if(groupType == VGACCEL_DEF){
            keyWords.removeAll("AX");
            keyWords.removeAll("AY");
            keyWords.removeAll("AZ");
            keyWords.append("DEF");
        }
        else if (groupType == VGACCEL_W) {
            keyWords.removeAll("WX");
            keyWords.removeAll("WY");
            keyWords.removeAll("WZ");
            keyWords.append("W");
        }
        return keyWords;
    }

} // namespace Radioss

 